package org.aksw.xoperator.command;

import java.util.regex.Pattern;

import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.packet.Message;



public abstract class Command {
	
	   /**
	    * 
	    * @return the keyword(s) that will trigger the execution of this command. 
	    */
	   public abstract String getKeyWord();
	   
	   
	   /**
	    * 
	    * @return a pattern to check if the call string is appropriate for the client
	    */
	   
	   public abstract Pattern getValidationPattern();
	   
	   
	   /**
	    * A short description about what this interaction does and how to interact syntactically correct with this command
	    * 
	    * @return the help text
	    */
	   public abstract String getHelp();
	   
	   public void perform(Chat chat, Message message){
		   

		   
		  // if(getValidationPattern().matcher(message.getBody()).matches()){
			   performInternal(chat, message);
//		   }else{
//			   try {
//				chat.sendMessage("Unable to parse Message: " + message.getBody());
//			} catch (XMPPException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//		   }
		   
		   
		   
	   }
	   
	   /**
	    * 
	    * 
	    * @param call
	    * @param control
	    * @param interactor
	    * @return
	    */
	   public abstract void performInternal(Chat chat, Message message);
	   

}
